﻿using System.Diagnostics.Contracts;
using O1.Kernel.Storage.Transactions;

namespace O1.Kernel.Storage
{
    internal partial class MultiVersionBinaryStorage
    {
        private struct Command
        {
            public readonly long TransactionId;

            public readonly byte[] Delta;

            public readonly long TargetId;

            public Command(long targetId, byte[] delta, long transactionId)
                : this()
            {
                Contract.Requires(targetId > -1);
                Contract.Requires(delta != null);

                this.Delta = delta;
                this.TransactionId = transactionId;
                this.TargetId = targetId;
            }

            [ContractInvariantMethod]
            private void ObjectInvariant()
            {
                Contract.Invariant(this.TargetId > -1);
                Contract.Invariant(this.Delta != null);
            }
        }
    }
}